// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import Vant from 'vant';
import 'vant/lib/index.css';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Vant);
Vue.use(ElementUI);
import request from "./utils/request"


Vue.config.productionTip = false
Vue.prototype.$axios = axios

window.location.search
.replace("?", "")
.split("&")
.forEach(async item=> {
  var temp = item.split("=");
  if(temp[0] === "token"){
    window.token = token;
  }
  if (temp[0] === "number") {
     var res =   await  request({
        method:'get',
        url: '/teacher',
        params: {
          query: {
            'number': temp[1]
          }
        }
      })
     if(res.data.length>0)
     {
       var vue =  new Vue({
        el: '#app',
        router,
        beforeCreate: function() {
          this.$root.user = res.data[0];
        },
        components: { App },
        template: '<App/>'
       })
     } 
     else{
        window.confirm("系统中无此老师存在").then(res=>{
          window.close();
        });
     }
  }
});
/* eslint-disable no-new */

